package com.galen.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.context.ApplicationContext;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import com.galen.bean.User;
import com.galen.dao.IUserDao;
import com.galen.dao.impl.UserDaoImpl;

public class UserActionImpl implements Controller {

	private String viewPage;
	private UserDaoImpl userdao ;
	@Override
	public ModelAndView handleRequest(HttpServletRequest arg0,
			HttpServletResponse arg1) throws Exception {
		ModelAndView mav = new ModelAndView();
		
		User u = new User(2001,"haha", "haha", "12");
		
		//IUserDao dao = new UserDaoImpl();
		
		//userdao.addUser(u);
		getUserdao().addUser(u);
		mav.addObject("user", u.getuId());
		mav.setViewName(getViewPage());
		return mav;
	}

	public String getViewPage() {
		return viewPage;
	}

	public void setViewPage(String viewPage) {
		this.viewPage = viewPage;
	}

	public UserDaoImpl getUserdao() {
		return userdao;
	}

	public void setUserdao(UserDaoImpl userdao) {
		this.userdao = userdao;
	}

	 

}
